package com.czz.portal.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.czz.portal.entity.Category;
import com.czz.portal.mapper.CategoryMapper;
import com.czz.portal.service.CategoryService;
import com.czz.portal.vo.SideBarVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @ClassName: CategoryServiceImpl
 * @Author Czz
 * @Date 2019/12/29
 * @Time 10:07
 **/
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {

    @Autowired
    CategoryMapper categoryMapper;

    @Override
    public List<SideBarVo> getCategorySideBar() {
        return categoryMapper.getCategorySideBar("0");
    }

    @Override
    public List<Category> getParentCategoryList() {
        QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("category_parent_id","0");
        List<Category> parentList = categoryMapper.selectList(queryWrapper);
        return parentList;
    }

    @Override
    public List<Category> getCategoryList() {
        QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
        queryWrapper.ne("category_parent_id","0");
        List<Category> categoryList = categoryMapper.selectList(queryWrapper);
        return categoryList;
    }
}
